/**
 * Created by Delicate on 2017/5/31.
 */
$(document).ready(function(){
	init();
    monitor();
    service();
});

function init(){

}

var successCallBack=function(data){
	if(data.result){
		window.location.href= contextPath+'/platform/feedback/success';
    }else{
        layer.alert(data.msg)
    }
}

function monitor(){
    $(".g-feedback .u-submit").on("click", function () {
        const contact = $("#contact").val().trim();
        const content = $("#content").val().trim();
        if(!contact){
            layer.alert("请输入您的联系方式");
            return;
        }
        
        if(!(/^1(3|4|5|7|8)\d{9}$/.test(contact))){
        	layer.alert("请输入正确的手机号格式");
            return;
        }
        
        if(!content){
            layer.alert("请输入您的意见（限500字内）");
            return;
        }
        
        var data = $("#feedback").serialize();
        var ajax = new BackendTool({"data":data,"method":"post","url":contextPath+"/platform/feedback/doFeedBack"});
        ajax.successCallBack = successCallBack;
        ajax.ajaxRequest();
        
    });
}
function service(){

}

